package com.adaxi.adc.business.manager.controller;

import com.adaxi.adc.business.manager.pojo.*;
import com.adaxi.adc.business.manager.service.impl.PassengerServiceImpl;
import com.adaxi.adc.business.manager.service.impl.PassengerTripServiceImpl;
import com.adaxi.adc.business.manager.service.impl.TripFeedbackServiceImpl;
import com.adaxi.adc.business.manager.service.impl.VehicleTripServiceImpl;
import com.adaxi.adc.common.common.CommonResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;


/**
 * 常嘉勇
 */
@RestController
@Api(tags = "反馈管理[后台管理系统]接口", value = "FeedbackController")
public class ResponseController {

    @Autowired
    TripFeedbackServiceImpl tripFeedbackService;
    @Autowired
    PassengerServiceImpl PassengerService;
    @Autowired
    VehicleTripServiceImpl VehicleTripService;
    @Autowired
    PassengerTripServiceImpl PassengerTripService;


    @GetMapping("/queryFeedback")
    @ApiOperation(value = "列表查询", notes = "分页列表排序查询")
    public CommonResult<List<TripFeedback>>  query(){

        return CommonResult.SUCCESS("查询成功",tripFeedbackService.queryTripFeedback());

    }
    @GetMapping("/queryFeedBackById/{id}/{id2}/{id3}")
    @ApiOperation(value = "按ID查询车辆行程和人员信息", notes = "按ID查询车辆行程和人员信息")
    public CommonResult<Map<String, Object>> queryBoth(@PathVariable Long id ,@PathVariable Long id2,@PathVariable Long id3) {

        VehicleTrip vehicleTrip = VehicleTripService.getById(id);
        Passenger passenger = PassengerService.getById(id2);
        PassengerTrip passengerTrip = PassengerTripService.getById(id3);

        Map<String, Object> result = new HashMap<>();
        result.put("vehicleTrip", vehicleTrip);
        result.put("passenger", passenger);
        result.put("passengerTrip", passengerTrip);

        return CommonResult.SUCCESS("查询成功", result);
    }


}
